package com.lib.framework.ext

/**
 * 扩展接口
 *
 * @author keanbin
 */


import androidx.annotation.NonNull
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer


/**
 * 没有抛异常的 observeForever
 */
fun <T> LiveData<T>.observeForeverNotException(@NonNull observer: Observer<T>) {
    try {
        observeForever(observer)
    } catch (e: Exception) {

    }
}

/**
 * 没有抛异常的 observeForever
 */
fun <T> LiveData<T>.observeNotException(@NonNull owner: LifecycleOwner, @NonNull observer: Observer<T>) {
    try {
        observe(owner, observer)
    } catch (e: Exception) {

    }
}
